package myenum;

import net.mindview.util.Enums;

public enum  Meal2 {
    APPETIZER(Food.Appetizer.class),MAINCOURSE(Food.MainCourse.class),DESSERT(Food.Dessert.class),COFFEE(Food.Coffee.class);

    private Food[] values;

    private Meal2(Class<? extends Food> kind) {
        this.values = kind.getEnumConstants();
    }

    public interface Food{
        //开胃菜
        enum Appetizer implements Food {
            SALAD,SOUP,SPRING_ROLLS; //沙拉，汤，弹簧卷;
        }

        //主菜
        enum MainCourse implements Food {
            LASAGNE,BURRITO,PAD_THAI,LENTILS,HUMMOUS,VINDALOO;//千层面,卷饼, ,扁豆
        }

        //甜点
        enum Dessert implements Food {
            TIRMISU,GELATO,BLACK_FOREST_CAKE,FRUIT,CREME_CARAMEL;
        }

        //咖啡
        enum Coffee implements Food {
            BLACK_COFFEE,DECAF_COFFEE,ESPRESSO,LATTE,CAPPUCCINO,TEA,HERB
        }
    }

    public Food randomSelection(){
        return Enums.random(values);
    }

    public static void main(String[] args) {
        for(int i = 0;i < 5; i++){
             for(Meal2 meal : Meal2.values()){
                 Food food = meal.randomSelection();
                 System.out.println(food);
             }
            System.out.println("-----------------");
        }
    }
}

